<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>

<body>

</body>
<script type="text/javascript">
    // 打印100以内所有偶数的和
    var sum = 0;
    for (var i = 0; i < 100; i++) {//2+4+6+8
        if (i % 2 === 0) {
            sum += i;//sum = sum + i;
        }
    }
    console.log("100以内的偶数和是:"+sum);
</script>

</html>